package com.student.controller;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.student.pojo.Fe;
import com.student.service.FeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
/**
 * @author 是一个鸽子啊
 * @date 2020/4/14
 * @qq 364826415
 */
@RestController
public class FeAjaxController {
    @Autowired
    @Qualifier("feServiceImpl")
    FeService feService;
    @RequestMapping("/queryFeByID")
    private String queryFeByID(String feID) throws JsonProcessingException {
        Fe fe = feService.queryFeByID(Integer.parseInt(feID));
        ObjectMapper objectMapper = new ObjectMapper();
        String val = objectMapper.writeValueAsString(fe);
        return val;
    }
    @RequestMapping("/queryFeListA")
    private String queryFeListA(String feID) throws JsonProcessingException {
        List<Fe> feList = feService.queryFeList();
        ObjectMapper objectMapper = new ObjectMapper();
        String val = objectMapper.writeValueAsString(feList);
        return val;
    }
}
